UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r3cXKtnjqN0EaVGHwJi4ejD0i4bnvqiiOd75o3laCrE=' 
WHERE 
  key_id = '282f72f4658d6c70675e31b45292404053d904ce6be40b0851a2304eec48e0a6' 
  AND (
    token = 'r3cXKtnjqN0EaVGHwJi4ejD0i4bnvqiiOd75o3laCrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024