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

Query time 0.00036