UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WEFg3fA+AiyL+AhxvG+qzbHzq9t8ywwHbHUGgJRx9Zk=' 
WHERE 
  key_id = '5855050e578983a468ad3e62c32596ef53003169a036b03e33092caff79d8203' 
  AND (
    token = 'WEFg3fA+AiyL+AhxvG+qzbHzq9t8ywwHbHUGgJRx9Zk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031