UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z1SiZWBwX1sLeqcDTgeK0eEp09muKkKKrB+9tghuCsI=' 
WHERE 
  key_id = 'd4dba3182d0c67811af0a3d37510a3046a47e174b090da0a075ad250a7eb832c' 
  AND (
    token = 'z1SiZWBwX1sLeqcDTgeK0eEp09muKkKKrB+9tghuCsI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031