UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wekI2E4/owKLijr5/PYAcd3z1/7IhSAncHCNwgFoh5Y=' 
WHERE 
  key_id = '313950c037c5c1d898104da6fc0b11909fb4be52c1fd655393eb496c5d62d0c7' 
  AND (
    token = 'wekI2E4/owKLijr5/PYAcd3z1/7IhSAncHCNwgFoh5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049