UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NbgDtdfEA3/EhARXHpIgW5sqjTMemfl/MijaX02IglA=' 
WHERE 
  key_id = 'dce8ba69bca7ac752bee28acb799509412aee12dca17598394a2c5991f372036' 
  AND (
    token = 'NbgDtdfEA3/EhARXHpIgW5sqjTMemfl/MijaX02IglA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045