UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K6CgRQWXEBVWrJnPTL9Uy05zbZ4lTLpj8cVE8cr47nY=' 
WHERE 
  key_id = '5cd097176cb2c943d6957d6ee9adc2e116372f6e8484377b96aa8ac4773ef8fb' 
  AND (
    token = 'K6CgRQWXEBVWrJnPTL9Uy05zbZ4lTLpj8cVE8cr47nY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044