UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BBWDSyT2VYXtwVJMNsIlIcnrjEdS/AwQfu4fmjmz9Gg=' 
WHERE 
  key_id = '3fb04a961b55bcf913464b5c3103b6b36a2595a5c380dd05347ed345bb208dff' 
  AND (
    token = 'BBWDSyT2VYXtwVJMNsIlIcnrjEdS/AwQfu4fmjmz9Gg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040