UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/ayXnfgpDWE3wWkFyWXKFJgI2KQ+thzk+sfoNt20WWU=' 
WHERE 
  key_id = '534ff56ae3292c394bfb01b5be0c1b14f21f0203825b4294acfc0d0645bee511' 
  AND (
    token = '/ayXnfgpDWE3wWkFyWXKFJgI2KQ+thzk+sfoNt20WWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032