UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XJhIFK1sz5DLkUZwbe4ToxcwpyvZVaNibuNYwbswKFk=' 
WHERE 
  key_id = '258b9c519902384cac91cf281ab44cd3e76362795986ef64ce86a041609dcc0e' 
  AND (
    token = 'XJhIFK1sz5DLkUZwbe4ToxcwpyvZVaNibuNYwbswKFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025