UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AUjuWvoWurmqr47kA3cgHl18MI3H7QpMQhTnqwh7lRU=' 
WHERE 
  key_id = 'd17fe05f2ec13ecbabc3d08be70350780127c92947ae7594ecf1bafc77757862' 
  AND (
    token = 'AUjuWvoWurmqr47kA3cgHl18MI3H7QpMQhTnqwh7lRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032