UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N9mA2+k39TRYVz/9H4+1zYW1juHf1PVHJBApAcQwii0=' 
WHERE 
  key_id = '83268ea4d9c5d06a020ac19e16413d7807ec008e0d7e6f683e5c87cc5116a777' 
  AND (
    token = 'N9mA2+k39TRYVz/9H4+1zYW1juHf1PVHJBApAcQwii0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023