UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jpbgqnGxzuM221wnEZAQw8S3CSUS9iat9Vd12Wbb9Fo=' 
WHERE 
  key_id = '87680feeac5b9d5242102edac5dc3f11978890753ba9f7c6526ef018c73ecb44' 
  AND (
    token = 'jpbgqnGxzuM221wnEZAQw8S3CSUS9iat9Vd12Wbb9Fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026