UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HFLLJ27jhQ0FE4+wBqsz9dylHxUsMqCNS3gvSIPy+L0=' 
WHERE 
  key_id = '15840d746b61b757bbd7d187de6d46f34f43a14c0befca9d921382185a2c234a' 
  AND (
    token = 'HFLLJ27jhQ0FE4+wBqsz9dylHxUsMqCNS3gvSIPy+L0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053