UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sr2k16fMDl1h53bo7hN33EOM1CGus3cgujACTnEAnpA=' 
WHERE 
  key_id = 'f6c63d95d6dcd93cb7734fdbcd6b4f2ec9fd745ec2f01937ecae7d25d7a8e377' 
  AND (
    token = 'sr2k16fMDl1h53bo7hN33EOM1CGus3cgujACTnEAnpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021