UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oyJSB5gGkHt9P5/s0F4JiFiIZWGZXNSM+PJ6RAbz50I=' 
WHERE 
  key_id = '87ef047f7f0f0489a4b7922565249da81490cec95bfd0826aad7bf3c14151601' 
  AND (
    token = 'oyJSB5gGkHt9P5/s0F4JiFiIZWGZXNSM+PJ6RAbz50I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028