UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'slaeDmBpK16vE3EqoVts9meAQ7TZu+07uIThyFqbsnw=' 
WHERE 
  key_id = '109ca70502172f9eeda53705a231f137ddbc558004ea8758c8b3b5b9690585a1' 
  AND (
    token = 'slaeDmBpK16vE3EqoVts9meAQ7TZu+07uIThyFqbsnw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032