UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Oe53Wo9KQYaaM4gsi2GiO0yE7zgBf0aaIsVNck7ypJU=' 
WHERE 
  key_id = 'f57a702df070d3c78a3e1139ca19c844221114abb8aa492c4077b33f050fa8f8' 
  AND (
    token = 'Oe53Wo9KQYaaM4gsi2GiO0yE7zgBf0aaIsVNck7ypJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070