UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sHdLckNpoQ6c+H/b4Iza1+P4TwCvFcVbqksKzmIRHXc=' 
WHERE 
  key_id = 'e06a5d35c7a945e1768d38e5e5706f0b6d298b389ec5d8aea1112ba89f67d050' 
  AND (
    token = 'sHdLckNpoQ6c+H/b4Iza1+P4TwCvFcVbqksKzmIRHXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071