UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QhL9hkaqbQ+VB9Qjkmn1lZh/Caq96TcB+HlOZfV/Kdg=' 
WHERE 
  key_id = '09afc311a59110360bf2f5dd722e143361fd489c6bb1d846a91d5d4b23a0dc0e' 
  AND (
    token = 'QhL9hkaqbQ+VB9Qjkmn1lZh/Caq96TcB+HlOZfV/Kdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031