UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B8nwbw1emvxQOC03MBuN8b6MttxuV9EsB8uQyiVFoNo=' 
WHERE 
  key_id = '87cb928447cb1b81d1453677802f6e6af1c09e794be7f5912c4dab12ce17ba56' 
  AND (
    token = 'B8nwbw1emvxQOC03MBuN8b6MttxuV9EsB8uQyiVFoNo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030