UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3hZMgw2KoGt1XqXfN2EW5lO1mEbTwI6jlJQ0Z+KqfWE=' 
WHERE 
  key_id = 'a24a856a2dce84b457207f136472015cf2ddcf468171327799690a926c7d39b2' 
  AND (
    token = '3hZMgw2KoGt1XqXfN2EW5lO1mEbTwI6jlJQ0Z+KqfWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036