UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd4uklvE2ztH3Z0mFCK8KYNC9UdcnkdPIghhk9jfqpkI=' 
WHERE 
  key_id = '1126be2290d3dd13feba85d9bdca88280ff38fa747fc80989368dfaafedaf019' 
  AND (
    token = 'd4uklvE2ztH3Z0mFCK8KYNC9UdcnkdPIghhk9jfqpkI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031