UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C9wZQkoTkEQK1Esv0C7b6pceBszJt9XIIPog9jW43kw=' 
WHERE 
  key_id = '38b23ec3c4a76605323ca0b4ea7dee7eac938a72cb7fbef06e9cae4c2bea9988' 
  AND (
    token = 'C9wZQkoTkEQK1Esv0C7b6pceBszJt9XIIPog9jW43kw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037