UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9TJUWFwjqeyGuxasJT+bjkr6201qSM5+csfnPtFeqzw=' 
WHERE 
  key_id = '7d09ff1e8cd68cfd822c242742d6bde0b2bc6d5f55970ae2a545d8f74ea3bcb8' 
  AND (
    token = '9TJUWFwjqeyGuxasJT+bjkr6201qSM5+csfnPtFeqzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036