UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9eORo4Ot7zko4ufjRbTlDKp0t1NZuX42ulAqXHb+of0=' 
WHERE 
  key_id = 'f30737186ce4268b681a7e80379ab2877016eebb854454bb52f4bd1e086b8d19' 
  AND (
    token = '9eORo4Ot7zko4ufjRbTlDKp0t1NZuX42ulAqXHb+of0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033