UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0uL6/r3hktM5S3cMHZzSCJCECPLEhhK5MJhAdxEfuWs=' 
WHERE 
  key_id = '20c8461efd3b23625968005a0a282a8f2d4e22f44e5cfbf82ced982aba3b3bc9' 
  AND (
    token = '0uL6/r3hktM5S3cMHZzSCJCECPLEhhK5MJhAdxEfuWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034