UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nJW3UtKP+3tYX7EBpP2uOyKrHeRsJBp9uH0IrqLX8U8=' 
WHERE 
  key_id = '6ec2b01d271351f06a61f03f572187c574a7f74e845ed071e072305b5451eb9c' 
  AND (
    token = 'nJW3UtKP+3tYX7EBpP2uOyKrHeRsJBp9uH0IrqLX8U8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028