UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YEAjMZrQTQPYOSlkjcSPpWAzdgwOvl+A0yqiq1BtKss=' 
WHERE 
  key_id = 'd4a41bd5b2350dba64022a7ffe1ac758dac060951b036fb1d31fdc14af9e0641' 
  AND (
    token = 'YEAjMZrQTQPYOSlkjcSPpWAzdgwOvl+A0yqiq1BtKss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039