UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nqkmD6GEhU2i8Iai6dXkuCEaYF4fB3wzTH4uWSBZWDE=' 
WHERE 
  key_id = '6f6d0ce926245f39a796a65e9e1fbb09745f42458f67f33da179d54305e09c89' 
  AND (
    token = 'nqkmD6GEhU2i8Iai6dXkuCEaYF4fB3wzTH4uWSBZWDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029